package c.m.d.b.rest.mapper;

import c.m.d.b.exception.CMDBException;

import java.io.Serializable;

public final class ErrorInfo implements Serializable
{
    private static final long serialVersionUID = 1L;

    private int errorCode;
    private String description;

    public ErrorInfo()
    {
        super();
    }

    public ErrorInfo(CMDBException exception)
    {
        super();
        this.errorCode = exception.getErrorCode().errorCode();
        this.description = exception.getLocalizedMessage();
    }

    public ErrorInfo(Exception exception)
    {
        super();
        this.errorCode = 500;
        this.description = exception.getLocalizedMessage();
    }

    public int getErrorCode()
    {
        return errorCode;
    }

    public String getDescription()
    {
        return description;
    }
}
